package com.poorstu.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import com.common.base.web.BaseAction;
import com.poorstu.manager.LoginMeg;
import com.poorstu.model.LoginMod;

public class MenberAddAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
			
		try{
			DynaActionForm dyna=(DynaActionForm)form;
			String userAccount=(String)dyna.get("userAccount");
			String userName=(String)dyna.get("userName");
			String userpwd=(String)dyna.get("userpwd");
			int role=(Integer)dyna.get("role");
			int classes=(Integer)dyna.get("classes");
			int college=(Integer)dyna.get("college");
			
			  LoginMod login=new LoginMod();
			  login.setName(userName);
			  login.setUserAccount(userAccount);
			  login.setPassword(userpwd);
			  LoginMeg loginMag=(LoginMeg)getBean("loginMeg");
			  loginMag.menberAdd(login, classes, role);
			  return mapping.findForward("succ");
		}catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
		  
	}
	

}
